import 'package:flutter/material.dart';

import '../pages/home/tab_bookstore/index.dart';
import '../pages/home/tab_bookshelf/index.dart';
import '../pages/home/tab_profile/index.dart';

class TabNavigator extends StatelessWidget {
  TabNavigator(this.index);

  final int index;

  List<Widget> tabview = [TabBookShelf(), TabBookStore(), TabProfile()];

  WidgetBuilder builder = (BuildContext context) {
    return TabBookShelf();
  };

  @override
  Widget build(BuildContext context) {
    return Navigator(
      initialRoute: '/',
      onGenerateRoute: (RouteSettings settins) {
        switch (settins.name) {
          case '/':
            builder = (BuildContext context) {
              return tabview[index];
            };
            break;
        }
        return MaterialPageRoute(builder: builder);
        /* return MaterialPageRoute(builder: (BuildContext context) {
          return tabview[index];
        }); */
      },
    );
  }
}
